var express = require('express');
var router = express.Router();

router.get('/getLoginStatus', function (req, res, next) {
  res.json({
    code: 1,
    data: {
      msg: '获取登录状态成功',
      userName: 'Shaker',
      icon: "/lib/adminlte/dist/img/user8-128x128.jpg"
    }
  });
});

router.post('/login', function (req, res, next) {
  if (req.body.account == 'test' && req.body.password == 'de34d5e3d85e728193db65739d82db3c') {
    res.json({ code: 1, data: { msg: '登录成功', url: '/' } });
  } else {
    res.json({ code: 0, data: { msg: '账号密码错误' } });
  }
});

router.get('/getMenu', function (req, res, next) {
  res.json([{
    url: "/widgets.html",
    name: "小部件",
    icon: "fas fa-th",
    badge: { class: "badge-danger", text: "New" }
  },
  {
    name: "图表",
    icon: "fas fa-chart-pie",
    children: [{
      url: "/lib/adminlte/pages/charts/chartjs.html",
      name: "ChartJS",
      icon: "far fa-circle",
      badge: { class: "badge-warning", text: "Hot" }
    }, {
      url: "/lib/adminlte/pages/charts/flot.html",
      name: "Flot",
      icon: "far fa-circle"
    }, {
      url: "/lib/adminlte/pages/charts/inline.html",
      name: "Inline",
      icon: "far fa-circle"
    }]
  },
  {
    url: "/lib/adminlte/pages/calendar.html",
    name: "日历",
    icon: "fas fa-calendar-alt",
    badge: { class: "badge-info", text: "20" }
  }]);
});


module.exports = router;
